package com.xinsoft.entity.dto;

import com.xinsoft.constant.Const;
import com.xinsoft.entity.po.SysMaterial;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 *  @author: π
 *  物料
 */
@Data
public class KisMaterielDto implements Serializable {
    private String FRECORDS; //编号 序号
    private String FItemId;
    private String FName;
    private String FNumber;
    private String FHelpCode;
    private String FModel;
    private String FAuxClassID;
    private String FAuxClassID_FName;
    private String FErpClsID_FName;
    private String FErpClsID;
    private String FTypeID;
    private String FTypeID_FName;
    private Integer FUnitID;
    private String FUnitID_FName;
    private String FSecInv;
    private String FUseState;
    private String FUseState_FName;
    private String FSecUnitID_FName;
    private String FSecCoefficient;
    private String FSecUnitID;
    //因返回的数据为科学计数法无法解析 暂时去除
//    private String FSecCoefficient;
    private String FDefaultLoc;
    private String FDefaultLoc_FName;
    private String FSPID_FFullName;
    private String FSPID;
    private BigDecimal FLowLimit;//最小库存
    private BigDecimal FHighLimit;//最大库存

    public static SysMaterial voToPo(KisMaterielDto vo) {
        if (vo == null) {
            return null;
        }
        SysMaterial sysMaterial = new SysMaterial();
        sysMaterial.setId(new Integer(vo.getFItemId()));
        sysMaterial.setMaterialNo(vo.getFNumber());
        sysMaterial.setMaterialSpecific(vo.getFModel());
        sysMaterial.setMaterialTypeId(31);
        sysMaterial.setAuditStatus(Const.AUDIT_STATUS_NORMAL);
        sysMaterial.setMaterialName(vo.getFName());
        sysMaterial.setMainUnitKis(vo.getFUnitID_FName());
        sysMaterial.setMainUnit(vo.getFUnitID());
        sysMaterial.setViceUnitKis(vo.getFSecUnitID_FName());
        sysMaterial.setConvCoefficient(vo.getFSecCoefficient());
        sysMaterial.setMaxStockNum(vo.getFHighLimit());
        sysMaterial.setMinStockNum(vo.getFLowLimit());
        return sysMaterial;
    }
}
